<template>
    <div>
       
        <div :style="{padding: '24px', minHeight: '480px', background: '#fff'}">
            <el-form ref="merchant" label-position="right" label-width="120px" :model="merchant" :rules="rules">
              
               
           
                <el-form-item label="原支付密码"  type="password"  prop="oldpassport">
                    <el-row>
                        <el-col :span="8"> <el-input v-model="merchant.oldpassport" placeholder="原支付密码" type="password" style="width: 240px" /></el-col>
                    </el-row>
                    
                </el-form-item>
                  <el-form-item label="新支付密码"  type="password"  prop="passport">
                    <el-row>
                        <el-col :span="8"> <el-input v-model="merchant.passport" placeholder="重复新支付密码"  type="password" style="width: 240px" /></el-col>
                    </el-row>
                    
                </el-form-item>
                  <el-form-item label="重复新密码"  type="password"  prop="cfgpassport">
                    <el-row>
                        <el-col :span="8"> <el-input v-model="merchant.cfgpassport" placeholder="重复新支付密码"  type="password" style="width: 240px" /></el-col>
                    </el-row>
                    
                </el-form-item>
           </el-form>
            <div>
                <el-button @click="cancel">取消</el-button>
                <el-button type="primary" :loading="modalLoading" @click="ok">确定</el-button>
            </div>
        </div>
    </div>
</template>
<script>
import api from '@/api/api';
export default {
    name: 'Merchant',
    data() {
        return {
            loading: false,
            modalLoading: false,

            others: {

            },
            merchant: {
                passport:'',
                oldpassport:'',
                cfgpassport:''
            },
            rules: {
                passport:[
                    { required: true, message: "原支付密码不能为空", trigger: "blur" }
                ],
                oldpassport:[
                    { required: true, message: "新支付密码不能为空", trigger: "blur" }
                ],
                cfgpassport:[
                    { required: true, message: "重复支付密码不能为空", trigger: "blur" }
                ]
            },

        };
    },
    mounted: function() {

       

    },
    methods: {
       
    

        ok: function() {
            
            this.$refs['merchant'].validate((valid) => {
            
                if (valid) {
                    this.okSubmit();
                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            
           
        },
        okSubmit:function(){
             if(this.merchant.passport!=this.merchant.cfgpassport)
            {
                 this.errorMessage('重复支付不一致');
                return ;
            }
            var me = this;

            me.modalLoading = true;
            me.$http.post("/merchant/dopaypwd.do", me.merchant).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("修改成功！");
                    me.merchant={};
                    me.modalEdit = false;

                } else {
                    me.errorMessage(body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.getDetail();
        }
    }
}
</script>
<style scoped>
</style>